﻿
@{
    Layout = null;
}

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title></title>
    <script src="~ueue.min.js"></script>
    <script src="~ue/axios.min.js"></script>
    <link href="~/BootstrapS/css/plugins/iCheck/custom.css" rel="stylesheet" />
    <link href="~/BootstrapS/css/plugins/sweetalert/sweetalert.css" rel="stylesheet">
    <link href="~/BootstrapS/css/plugins/datapicker/datepicker3.css" rel="stylesheet" />
</head>
<body class="gray-bg">
    <div id="adddiv">
        <div class="modal-header">
            <button type="button" class="close" data-dismiss="modal" aria-hidden="true" style="font-size:30px">
                &times;
            </button>
            <h3 class="modal-title" id="myModalPatient">新增患者信息</h3>
        </div>
        <div>
            <div style="width:45%;float:left;margin-left:20px;margin-top:15px">
                患者姓名
                <input type="search" class="form-control input-sm" v-model="name" aria-controls="DataTables_Table_0" style="width:240px" placeholder="请输入病人姓名">
                <br /><br />
                患者年龄
                <input type="search" class="form-control input-sm" v-model="age" aria-controls="DataTables_Table_0" style="width:240px" placeholder="请输入病人年龄">
                <br /><br />
                出生日期<br />
                <div class="form-group" id="data_1">
                    <div class="input-group date">
                        <span class="input-group-addon">
                            <i class="fa fa-calendar"></i>
                        </span>
                        <input type="text" class="form-control" value="2014-11-11" style="width:200px">
                    </div>
                </div>
                <br /><br />
                邮箱地址
                <input type="search" class="form-control input-sm" v-model="email" aria-controls="DataTables_Table_0" style="width:240px" placeholder="请输入邮箱地址">
                <br /><br />
            </div>
            <div style="width:45%;float:right;margin-left:10px;margin-top:15px">
                身份证号
                <input type="search" class="form-control input-sm" v-model="patidnumber" aria-controls="DataTables_Table_0" style="width:240px" placeholder="请输入身份证号">
                <br /><br />
                患者性别
                <br /><br />
                <input type="radio" id="sex1" name="sexname" v-model="sex" value="0">
                <label for="0">男</label>
                <input type="radio" id="sex2" name="sexname" v-model="sex" style="margin-left:20px" value="1">
                <label for="1">女</label>
                <br /><br />
                联系方式
                <input type="search" class="form-control input-sm" v-model="iphone" aria-controls="DataTables_Table_0" style="width:240px" placeholder="请输入手机号">
                <br /><br />
                选择就诊科室<br />
                <select id="Selecttab" class="btn btn-outline btn-success" v-model="outid" style="width:200px">
                    <option v-bind:value="0">请选择就诊科室</option>
                    <option v-for="item in info" v-bind:value="item.outpatient_Id">{{item.outpatient_Name}}</option>
                </select>
                <br /><br />
            </div>
        </div>
        <div style="width:90%;float:left;margin-left:20px">
            家庭住址<textarea id="TextArea1" class="form-control input-sm" v-model="home" aria-controls="DataTables_Table_0" rows="6" cols="15" placeholder="请输入其他备注信息"></textarea>
            <br /><br />
        </div>
        <div class="modal-footer">
            <div style="float:right">
                <button type="button" class="btn btn-outline btn-default" data-dismiss="modal">
                    退出
                </button>
                <button type="button" id="tjbutton" class="btn btn-outline btn-warning" v-on:click="addpatient">提交</button>
            </div>
        </div>
    </div>
    <script src="~/BootstrapS/js/plugins/datapicker/bootstrap-datepicker.js"></script>
    <script src="~/BootstrapS/js/plugins/cropper/cropper.min.js"></script>
    <script src="~/BootstrapS/js/demo/form-advanced-demo.min.js"></script>
</body>
</html>
<script src="~/BootstrapS/js/jquery.min.js"></script>
<script src="~/BootstrapS/js/bootstrap.min.js"></script>
<script src="~/BootstrapS/js/plugins/metisMenu/jquery.metisMenu.js"></script>
<script src="~/BootstrapS/js/plugins/slimscroll/jquery.slimscroll.min.js"></script>
<script src="~/BootstrapS/js/plugins/layer/layer.min.js"></script>
<script src="~/BootstrapS/jslus.min.js"></script>
<script src="~/BootstrapS/js/contabs.min.js"></script>
<script src="~/BootstrapS/js/plugins/pace/pace.min.js"></script>
<script src="~/vue/axios.min.js"></script>
<script src="~/vue/qs.min.js"></script>
<script src="~/vue/vue.min.js"></script>
<script src="~/BootstrapS/js/plugins/iCheck/icheck.min.js"></script>
<script src="~/BootstrapS/js/plugins/sweetalert/sweetalert.min.js"></script>
<script src="~/BootstrapS/js/plugins/datapicker/bootstrap-datepicker.js"></script>
<script src="~/BootstrapS/js/plugins/cropper/cropper.min.js"></script>
<script src="~/BootstrapS/js/demo/form-advanced-demo.min.js"></script>

<script>
    new Vue({
        el: '#adddiv',
        data: {
            info: null,
            name: '',
            birthday: '',
            sex: '',
            age: '',
            outid: 0,
            patidnumber: '',
            iphone: '',
            email: '',
            home: ''
        },
        mounted: function () {
            axios
                .get('/Patient/GetOutpatient')
                .then(response => (this.info = response.data))
                .catch(function (eatch) {
                    console.log(eatch);
                })
        },
        methods: {
            addpatient() {
                var obj = {
                    Patient_Name: this.name,
                    Patient_Age: this.age,
                    Patient_Sex: this.sex,
                    Outpatient_Id: this.outid,
                    Patient_State: 1,
                    Streat: 0,
                    Patient_IDnumber: this.patidnumber,
                    Patient_Birthday: this.birthday,
                    Patient_IPhone: this.iphone,
                    Patient_Email: this.email,
                    Patient_Home: this.home
                }
                axios
                    .post('/Patient/AddPatient', window.Qs.stringify(obj))
                    .then(function (response) {
                        if (response.data.success == true) {
                            swal({
                                title: response.data.message,
                                text: "",
                                type: "success",
                                confirmButtonText: "确定",
                                closeOnConfirm: false
                            }, function () {
                                location.reload();
                            })
                        }
                        else {
                            swal({
                                title: response.data.message,
                                text: "",
                                type: "warning",
                                confirmButtonText: "确定",
                                closeOnConfirm: false
                            })
                        }
                    })
                    .catch(function (error) {
                        console.log(error);
                    })
            }
        }
    })

    laydate({
        elem: "#hello",
    });
</script>